From: Brion Vibber Date: Sat, 24 Apr 2004 09:28:22 +0000 (+0000) Subject: Fix category link display for unmade pages; it used to display every page in the... X-Git-Tag: 1.3.0beta1~289 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=09b9b3a92fab7e87af0fd872df8d32195df87738;p=lhc%2Fweb%2Fwiklou.git Fix category link display for unmade pages; it used to display every page in the database instead of just linking pages --- diff --git a/includes/Parser.php b/includes/Parser.php index 4d42876313..6a39244396 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -276,14 +276,17 @@ class Parser $id = $this->mTitle->getArticleID() ; # For existing categories - $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,links WHERE l_to={$id} AND l_from=cur_id"; - $res = wfQuery ( $sql, DB_READ ) ; - while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; - - # For non-existing categories - $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,brokenlinks WHERE bl_to={$id} AND bl_from=cur_id" ; - $res = wfQuery ( $sql, DB_READ ) ; - while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; + if( $id ) { + $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,links WHERE l_to={$id} AND l_from=cur_id"; + $res = wfQuery ( $sql, DB_READ ) ; + while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; + } else { + # For non-existing categories + $t = wfStrencode( $this->mTitle->getPrefixedDBKey() ); + $sql = "SELECT DISTINCT cur_title,cur_namespace FROM cur,brokenlinks WHERE bl_to='$t' AND bl_from=cur_id" ; + $res = wfQuery ( $sql, DB_READ ) ; + while ( $x = wfFetchObject ( $res ) ) $data[] = $x ; + } # For all pages that link to this category foreach ( $data AS $x )